<html>
<meta http-equiv="Content-Type" Content="text/html; charset=utf-8" />

<head>
	<title>zzz :: Dev Page</title>
	
<style type="text/css">

	a:link		{ color: 0x000080 }
	a:visited	{ color: 0x000080 }
	a:active	{ color: 0x000080 }
	a:hover		{ color: 0x008080 }
	
	table
	{
		color: 0x000000;
		background: white;
		font-family: verdana, tahoma, arial;
		font-size: 8pt;
	}
	
</style>


<script>

    /*sicuster - 웹페이지 오류메시지 중 이 개체가 이 메소드를 지원하지 않거나 속성이 없다고 하면 일단 
      함수 철자 검사 해서 틀린것이 없는지 확인 
    */

    //var rrr;

    
    function Init() 
    {
        //zzz.CullSet(1, 5000);

        zzz.CamSet("RotateMode", "On");
        //zzz.CamSetZoomRatio(1, 2);
        zzz.CamSetSlide(false);
        zzz.EnvFPSVisible(true);
        zzz.EnvDataSetName("seoul_test2_111207");
        //zzz.EnvSet("ModelCullType", "NONE");
        
        //zzz.EnvSet("BackGroundColor", "255^0^0^128");
        zzz.EnvSet("TerrainLevelfactor", "7");
        zzz.EnvSet("TerrainWebMapUpperLevel", "false");

        //zzz.DlgVisible("MouseCoord", true);

        //zzz.MouseModeOption("Camera", "Zoomin", "WheelForward");
        //zzz.MouseModeOption("Camera", "Panning", "left");
        // puos 20101109
        //zzz.EnvDataSetName("koica");

        //zzz.EventSet("Camera", "on");

        //zzz.EnvSet("TerrainMaxResolution", "0.15");

        zzz.DlgVisible("CameraUI", true);
        zzz.DlgDock("CameraUI", 9); // 위치
        zzz.DlgSet("CameraUIScale", 0.5);  // 크기

        zzz.DlgSet("indexmapscale", "1.0");
        zzz.DlgSet("IndexMapPointerType", "Type1");
        zzz.DlgUrl("indexmap", "D:\\temp\\temp_user\\ksic\\index.png");
         //zzz.DlgUrl("indexmap", "http://30.30.30.3/seoul/seoul_indexmap_20100204.jpg");
        zzz.DlgPos("indexmap", 400, 400);
          //zzz.DlgVisible("indexmap", true);
        
        zzz.DlgVisible("Skybox", true);

        zzz.DlgVisible("CameraUI", true);

        //zzz.DlgSet("PopupButtonCount", 1);

        //zzz.OverlaySet("exclude", "ys_real");
    }
    
    
    
    
	/////////// 지형 데이터 TERRAIN itf 올리기
    function LayerTerrain(layerName,url) 
    {
        zzz.LayerMake(layerName, "terrain", url);
        //zzz.LayerVisibleLevel(layerName, 30, 128);
        
        zzz.LayerGridBlockSize(layerName, 1000);
        zzz.LayerMaxDistance(layerName, 10000);
        zzz.LayerDepthInfo(layerName, "on");
        
        zzz.LayerLoad(layerName);
        //zzz.LayerDepthInfo(layerName, "off");
    }
    
    
    //지형열기
    function LoadTerrain() {

        Init();
        //서울
        LayerTerrain("terrain", "http://20.20.20.34:8080/intramap3d/3DDB/_0519/itf/Yeosu.itf"); 
       // LayerTerrain("terrain", "http://210.90.46.79/3ddb/terrain/seoul_2010.itf");
        zzz.CamFit();
    }

    function CamFit() {
	    zzz.CamFit();
	    //zzz.CameraRotateByAngle(45, -88);
	    //zzz.CameraRotateByAngle(0, -45);
	    //alert(zzz.GetScreenCenter());
	 }
    
    function TerrainShow() { zzz.LayerVisible("terrain", true); }
    function TerrainHide() { zzz.LayerVisible("terrain", false); }
    
    
    
    /////// 지형 데이터 Grid 올리기
    function LoadGrid() {

    	Init();
	    //LayerGrid("yjb5", "C:\\3dsdumptest\\works\\1\\grid\\RYJ.grid", 4000, "");
	    //LayerGrid("yjb5", "F:\\work\\last\\proj\\3dweb\\의정부 공간업무 지원시스템 구축\\data\\grid\\4face_share\\RYJ.grid", 4000, "");
	    
    	var layerName;
        var url;
//         layerName = "가로수"; rscPath = "rsc_roadtree";
//         url = "http://210.90.46.79/3ddb/DX/grid_copy/SEOUL_SI_ROADTREE_090216.grid"; LayerGrid(layerName, url, 4000, rscPath);
// 
        layerName = "EXPO"; rscPath = "grid.EXPO";
        url = "http://20.20.20.34:8080/intramap3d/3DDB/_0519/grid/grid_20140410/EXPO.grid";
        LayerGrid(layerName, url, 4000, rscPath);
	}
    
    function LayerGrid(layerName, url, maxdist, rscPath) {
        zzz.LayerMake(layerName, "grid", url);

        // optional        
        zzz.LayerRscPath(layerName, rscPath);
        zzz.LayerMaxDistance(layerName, maxdist);
        //zzz.LayerGridInfo(layerName, "GridZ","on");
        zzz.LayerColor2(layerName, 255, 0, 0, 255);
        
        zzz.LayerLoad(layerName);
    }
    
    function BuildingShow() {
	     zzz.LayerVisibleType("grid", "", true);
	     zzz.LayerVisibleType("scene", "", true); 
	 
	 }
	 function BuildingHide() {
	     zzz.LayerVisibleType("grid", "", false);
	     zzz.LayerVisibleType("scene", "", false); 
	 }
    
	 
	 
	 
	 
	 //////// shp 파일 텍스처레이어 연동 ////////////
	 function TextureLayerLoad()
	    {
	    	//Init() ;
	    	
		  	layerName = "img"
		  	url = "http://20.20.20.34:8080/intramap3d/3DDB/_0519/grid/shp/expo.shp"
		  	// 편집용.
		  	//IMap3DActiveX.LayerMake(layerName, "TextureSimple",url);
		  	// 뷰잉용.
		  	zzz.LayerMake(layerName, "Texture", url);
		  	// 셋중하나선택
		  	zzz.LayerPolygonMode(layerName, "Both");
		  	// IMap3DActiveX.LayerPolygonMode(layerName, "Polygon");
		  	// IMap3DActiveX.LayerPolygonMode(layerName, "Outline");
		  	zzz.LayerColor(layerName, 255, 0, 0, 128); // 면컬러
		  	zzz.LayerColor2(layerName, 255, 255, 0, 128); // 라인컬러
		  	zzz.LayerLoad(layerName);
	    }
	    
	    function LoadTexureLayer() {
		    var layerName = "";
		    var url = "";
		    zzz.EnvSet("AutoLayerTextureUpdate","on");	    
		    LayerTex("oil", "http://20.20.20.34:8080/intramap3d/3DDB/_0519/grid/shp/expo.shp", "Both", 255, 0, 0);
		    zzz.LayerTextureUpdate();   
		}
	    
	    
	    function LayerTex(layerName, url, mode,r,g,b) {
	        //zzz.LayerMake(layerName, "texturesimple", url);
	        zzz.LayerMake(layerName, "texture", url);
	        zzz.LayerPolygonMode(layerName, mode);
	        
	        zzz.LayerColor(layerName, r, g, b, 100);	// 투명도
	        zzz.LayerColor2(layerName, 0, 0, 0, 105);	// 투명도
	        
	        //zzz.LayerOverlay(layerName, true);
	        //zzz.LayerFilter(layerName, "REGEN");
	        zzz.LayerLineInfo(layerName, "Bydistance", 10);
	        //zzz.LayerLineInfo(layerName, "", 3);
	        //zzz.LayerLineInfo(layerName, "Bydistance", 3);
	        zzz.LayerLoad(layerName);
	    }
	    
	    
	    function start() {
	 	   gCnt = 0;  
	 		zzz.MouseMode("PickPoint"); // 마우스 모드 변경
	 		zzz.AnalysisVisibilityStart(sx, sy, sz, tx, ty, tz);
	 	}
	 	
	 	function end() {
	 	 	zzz.AnalysisVisibilityEnd();
	 	}
	    
	 	function MouseModePickobj() {
 		  zzz.MouseMode("Pickobj");
 		}

	 	function DayLightStart() {
 	      var startYear = 2010;
 	      var startMonth = 5;
 	      var startDay = 24;
 	      var startHour = 8;
 	      var startMinites = 0;

 	      var endYear = 2010;
 	      var endMonth = 5;
 	      var endDay = 24;
 	      var endHour = 19;
 	      var endMinites = 0;

 	      zzz.AnalysisSunlightStart(startYear, startMonth, startDay, startHour, startMinites, endYear, endMonth, endDay, endHour, endMinites);
	 	}

	 	function DayLightEnd() {
	 	      zzz.AnalysisSunlightEnd();
	 	}

	 	function MouseModeDrag() {
			zzz.MouseMode("Drag");
		}
	 	
	 	function dlgInvisible() {
	 		zzz.DlgVisible("ELEVATION", false);
	 	}


	 	
	 	function FloodStart() {
 		  var r, g, b, a, color;
 		  r = 0; 
 		  g = 51;
 		  b = 153;
 		  a = 220;
 		  color = r + "^" + g + "^" + b + "^" + a;
 		  zzz.SetDrawInfo("color", color); // 색상 설정

 		  var speed = 20;
 		  zzz.AnalysisFloodInfo("speed", speed); // 속도 설정

 		  var height = 60;
 		  zzz.AnalysisFloodStart(height); // 높이 설정

 		  zzz.EnvSet("ComputeNearFar", "on"); // Z fighting 처리
 		}

	 	function FloodEnd() {
 		  zzz.AnalysisFloodEnd();
 		  zzz.EnvSet("ComputeNearFar", "off");
 		}

	 	function HeightStart() {
 	      var height=50;
 	      zzz.AnalysisAltitudeStart(height);
	 	}

	 	function HeightEnd() {
	 	      zzz.AnalysisAltitudeEnd();
	 	}

	 	 var g_young_count = 1;
	 	
	 	 
	 	function DrawPolygon() {
			var x, y, url
			x = "196475.5570"
			y = "451249.5753"
			url = "D:\\11.shp"
			var data=x+"^"+y+"^"+url
			var id = zzz.GetGeometry("Point", data);
			var string = id
			zzz.SetDrawInfo("Color", "255^0^0^150");
			zzz.DrawGeometry("", string);
	   }
	 	 
	 	 
	 	function grawGround(gid){
	 		if (g_young_count == 1) {
	            g_young_count = 2;
	            zzz.DrawGeometry("gid", gid);

	            re = zzz.GetArea("gid", gid);

	            g_area1 = re;
	            //alert(re);

	        } else {
		        g_young_count = 1;
		
		        Test_DrawBuilding(gid);
		
		        re = zzz.GetArea("gid", gid);
		        g_area2 = re;
	        }
	 	}
	 	
	 	function Test_DrawBuilding(gid) {

	        var numFloor = 10;
	        var FloorHeight = 3.5;
	        var tex = "";
	        var re = "id1^"+gid + "^" + numFloor + "^" + FloorHeight + "^" + tex;
	        //var re = gid + "^" + numFloor + "^" + FloorHeight + "^" + tex;
	        //zzz.DrawBuilding("build", "pattern", re);
	        zzz.DrawBuilding("build", "patternID", re);
	    }
	 	
	 	function mouseMode() {
	 		zzz.MouseModeOption("DRAWPOINTS", "Mode", "Polygon");
	 		zzz.MouseMode("DRAWPOINTS");
	 	}
	 	
	 	var sx, sy, sz, tx, ty, tz; // 가시권전역변수
	 	var gCnt;            // 가시권카운터

	 	
	 	function visStart() {
	 		alert("a");
		 	gCnt = 0;  
	
		 	zzz.MouseMode("PickPoint"); // 마우스 모드 변경
	
		 	zzz.AnalysisVisibilityStart(sx, sy, sz, tx, ty, tz);
	 	}

	 	function vend() {
	 		zzz.AnalysisVisibilityEnd();
	 	}
	 	
</script>

    <!-- fire fire fire fire ----------------------------------------- -->
<script language="javascript" for="zzz" event="OnPickPoint(x,y,z)">
	if (gCnt == 0) { // 측정위치 저장
		alert("1");
		sx = x;
		sy = y;
		sz = z;
		//VisCnt++;
		gCnt++;
	} else if (gCnt == 1) { // 목적위치 저장
		alert("2");
		tx = x;
		ty = y;
		tz = z;
		visStart(); // 가시권 시작 함수
	}
</script>

<script language="javascript" for="zzz" event="OnPickPointNormal(x,y,z,nx,ny,nz)">
	zzz.AnalysisSlopeStart(x, y, z, nx, ny, nz);
</script>

<script language="javascript" for="IMap3DActiveX" event="OnPickGeometry(id)">
	EventOnPickGeometry(id);
</script>

</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<h5>1.1. 지형 데이터 올리기(terrain itf)</h5>

	<table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%">
		<tr height="20" id="group0" style="display:''">
			<td>
				<form name="input">
				<table cellpadding="0" cellspacing="0" border="1" bordercolor="#66668C" width="100%" height="100%" >
					<tr>
						<td><a href="javascript:LoadTerrain();">지형열기</a></td>
						<td><a href="javascript:LoadGrid();">그리드</a>	</td>
						<td><a href="javascript:TerrainShow();">지형보기</a>	</td>
						<td><a href="javascript:TerrainHide();">지형숨기기</a> </td>
                        <td><a href="javascript:BuildingShow();">건물보기</a>	</td>
                        <td><a href="javascript:BuildingHide();">건물숨기기</a> </td>
					</tr>
					<tr>
						<td><a href="javascript:TextureLayerLoad();">shape 파일</a> </td>
						<td><a href="javascript:LoadTexureLayer();">텍스처레이어열기</a> </td>
						<td><a href="javascript:visStart();">가시권</a></td>
						<td><a href="javascript:vend();">가시권종료</a></td>
						<td><a href="javascript:MouseModePickobj();">일조권 마우스</a></td>
						<td><a href="javascript:DayLightStart();">일조권시작</a></td>
						<td><a href="javascript:DayLightEnd();">일조권끝</a></td>
					</tr>
					
					<tr>
						<td><a href="javascript:MouseModeDrag();">경사도 시작</a> </td>
						<td><a href="javascript:dlgInvisible();">경사도 종료</a></td>
						<td><a href="javascript:FloodStart();">침수 시작</a> </td>
						<td><a href="javascript:FloodEnd();">침수 종료</a></td>
						<td><a href="javascript:HeightStart();">고도분석 시작</a> </td>
						<td><a href="javascript:HeightEnd();">고도분석 종료</a></td>
						<td><a href="javascript:grawGround();">적정 분석</a></td>
					</tr>
					<tr>
						<td><a href="javascript:mouseMode();">그리기 모드</a></td>
						<td><a href="javascript:DrawPolygon();">적정 분석</a></td>
					</tr>
				</table>
				</form>
			</td>
		</tr>

		<tr>
			<td>
                <Object width="100%" height="100%" id="zzz" classid="clsid:C9320467-644F-43DA-B3FB-B23342B4EAF0" #version=1,0,0,0"></Object>
			</td>
		</tr>
		
	</table>

</body>
</html>





